<?php
/**
 * Created by PhpStorm.
 */

use Biz\service\activity\Coupon as sCoupon;

/**
 * @deprecated
 */
class BatchReceiveAction extends ActionPlugin
{
    const USER_LEVEL = self::LEVEL_REGISTER;
    const DEFAULT_ERROR_CODE = self::API_CODE_ERROR;
    const ACTION_TYPE = "coupon";

    public function main()
    {
        $couponIds = $this->getRequest()->getPost('coupon_ids', '');
        $moduleId = $this->getRequest()->getPost('module_id', '');
        Doraemon\tools\Log::info('领取优惠券start', compact('couponIds', 'moduleId'));

        if ($moduleId) {
            $result = sCoupon::pageReceive($this->uid, $moduleId, $couponIds);
        } else {
            $result = sCoupon::batchReceive($this->uid, $couponIds);
        }
        Doraemon\tools\Log::info('领取优惠券result', compact('couponIds', 'moduleId', 'result'));
        $this->setSuccess($result);

    }

}
